package gui;

import domein.Gebruiker;
import domein.Webinar;
import domein.WebinarController;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;
import java.util.Observer;
import javax.swing.Box;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.Timer;

/**
 *
 * @author Robin
 */
public class WebinarMain extends javax.swing.JFrame implements Observer {

    /** Creates new form WebinarMain */
    Gebruiker g;
    int gid;
    WebinarController wc;
    DefaultListModel lijstActief1;
    Image bgImage = null;
    String message = "";
    Timer timer;

    public WebinarMain(int gebruikerID) {
        System.setProperty("apple.laf.useScreenMenuBar", "true");

        wc = WebinarController.getInstance();
        wc.addObserver(this);

        gid = gebruikerID;

        g = wc.getR().getGebruikers().get(gebruikerID);
        setTitle(g.getFamilienaam());
        lijstActief1 = wc.geefActieveWebinars(gid);

        initComponents();

        ActionListener taskPerformer = new ActionListener() {

            public void actionPerformed(ActionEvent evt) {
                DefaultListModel lijstActief2;
                lijstActief2 = wc.geefActieveWebinars(gid);

                if (!lijstActief1.equals(lijstActief2)) {
                    lijstActief1 = lijstActief2;
                }
                listActief.setModel(lijstActief1);
            }
        };
        timer = new Timer(5000, taskPerformer);
        timer.start();

        //scherminstellingen:
        Toolkit tk = Toolkit.getDefaultToolkit();

        Dimension screenSize = tk.getScreenSize();
        int screenWidth = screenSize.width;

        setLocation((screenWidth - 1024) / 2, 0);
        setSize(1000, 700);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        btnNieuw = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jListIngeschreven = new javax.swing.JList();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jListGepasseerde = new javax.swing.JList();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jListGeplande = new javax.swing.JList();
        jPanel1 = new javax.swing.JPanel();
        scrollActief = new javax.swing.JScrollPane();
        listActief = new javax.swing.JList();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jListBeschikbare = new javax.swing.JList();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jListGebruikers = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItemVerwijderen = new javax.swing.JMenuItem();
        jMenuItemUitloggen = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(204, 255, 255));
        setBounds(new java.awt.Rectangle(0, 0, 1000, 600));
        setMaximizedBounds(new java.awt.Rectangle(0, 0, 0, 600));
        setResizable(false);
        getContentPane().setLayout(null);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Nieuwe Webinar", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel3.setOpaque(false);
        jPanel3.setPreferredSize(new java.awt.Dimension(200, 125));
        jPanel3.setRequestFocusEnabled(false);

        btnNieuw.setText("Aanmaken");
        btnNieuw.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        btnNieuw.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNieuwActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addComponent(btnNieuw, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(btnNieuw, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jPanel3);
        jPanel3.setBounds(720, 0, 260, 125);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ingeschreven Webinars", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel5.setOpaque(false);
        jPanel5.setPreferredSize(new java.awt.Dimension(1000, 125));

        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        jListIngeschreven.setBackground(new java.awt.Color(204, 255, 255));
        jListIngeschreven.setModel(wc.geefIngeschrevenWebinars(gid));
        jListIngeschreven.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListIngeschreven.setCellRenderer(new WebinarCellRenderer());
        jListIngeschreven.setFixedCellHeight(80);
        jListIngeschreven.setFixedCellWidth(200);
        jListIngeschreven.setFocusable(false);
        jListIngeschreven.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
        jListIngeschreven.setVisibleRowCount(1);
        jListIngeschreven.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jListIngeschrevenMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jListIngeschreven);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 956, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
        );

        getContentPane().add(jPanel5);
        jPanel5.setBounds(0, 390, 980, 125);

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Gepasseerde Webinars", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel7.setFocusable(false);
        jPanel7.setOpaque(false);
        jPanel7.setPreferredSize(new java.awt.Dimension(1000, 125));
        jPanel7.setRequestFocusEnabled(false);

        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        jListGepasseerde.setBackground(new java.awt.Color(204, 255, 255));
        jListGepasseerde.setModel(wc.geefGepasseerdeWebinars(gid));
        jListGepasseerde.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListGepasseerde.setCellRenderer(new WebinarCellRenderer());
        jListGepasseerde.setFixedCellHeight(80);
        jListGepasseerde.setFixedCellWidth(200);
        jListGepasseerde.setFocusable(false);
        jListGepasseerde.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
        jListGepasseerde.setVisibleRowCount(1);
        jListGepasseerde.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jListGepasseerdeMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(jListGepasseerde);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 956, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
        );

        getContentPane().add(jPanel7);
        jPanel7.setBounds(0, 520, 980, 125);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Geplande webinars", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel6.setFocusable(false);
        jPanel6.setMaximumSize(new java.awt.Dimension(350, 250));
        jPanel6.setOpaque(false);
        jPanel6.setPreferredSize(new java.awt.Dimension(350, 250));
        jPanel6.setRequestFocusEnabled(false);

        jScrollPane5.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        jListGeplande.setBackground(new java.awt.Color(204, 255, 255));
        jListGeplande.setModel(wc.geefGeplandeWebinars(gid));
        jListGeplande.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListGeplande.setCellRenderer(new WebinarCellRenderer());
        jListGeplande.setFixedCellHeight(80);
        jListGeplande.setFocusable(false);
        jListGeplande.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jListGeplandeMouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(jListGeplande);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jPanel6);
        jPanel6.setBounds(390, 130, 330, 250);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Actieve Webinars", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel1.setOpaque(false);

        scrollActief.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        scrollActief.setFocusable(false);

        listActief.setBackground(new java.awt.Color(204, 255, 255));
        listActief.setModel(lijstActief1);
        listActief.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        listActief.setCellRenderer(new WebinarCellRenderer());
        listActief.setFixedCellHeight(80);
        listActief.setFixedCellWidth(200);
        listActief.setFocusable(false);
        listActief.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
        listActief.setVisibleRowCount(1);
        listActief.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listActiefMouseClicked(evt);
            }
        });
        scrollActief.setViewportView(listActief);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scrollActief, javax.swing.GroupLayout.DEFAULT_SIZE, 696, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(scrollActief, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
        );

        getContentPane().add(jPanel1);
        jPanel1.setBounds(0, 0, 720, 125);

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Beschikbare Webinars", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel2.setFocusable(false);
        jPanel2.setMaximumSize(new java.awt.Dimension(350, 250));
        jPanel2.setOpaque(false);
        jPanel2.setPreferredSize(new java.awt.Dimension(350, 250));
        jPanel2.setRequestFocusEnabled(false);

        jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        jListBeschikbare.setBackground(new java.awt.Color(204, 255, 255));
        jListBeschikbare.setModel(wc.geefBeschikbareWebinars(gid));
        jListBeschikbare.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListBeschikbare.setCellRenderer(new WebinarCellRenderer());
        jListBeschikbare.setFixedCellHeight(80);
        jListBeschikbare.setFocusable(false);
        jListBeschikbare.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jListBeschikbareMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(jListBeschikbare);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jPanel2);
        jPanel2.setBounds(0, 130, 380, 250);

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Andere gebruikers", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
        jPanel8.setFocusable(false);
        jPanel8.setOpaque(false);
        jPanel8.setPreferredSize(new java.awt.Dimension(350, 250));

        jScrollPane4.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        jListGebruikers.setBackground(new java.awt.Color(204, 255, 255));
        jListGebruikers.setModel(wc.geefAlleGebruikers(gid));
        jListGebruikers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListGebruikers.setFocusable(false);
        jScrollPane4.setViewportView(jListGebruikers);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jPanel8);
        jPanel8.setBounds(720, 130, 260, 250);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/background.jpg"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, -20, 1040, 740);

        jMenu1.setText("Webinar");

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem3.setText("Nieuwe webinar");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Account");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Wijzigen");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuItemVerwijderen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemVerwijderen.setText("Verwijderen");
        jMenuItemVerwijderen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemVerwijderenActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItemVerwijderen);

        jMenuItemUitloggen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemUitloggen.setText("Uitloggen");
        jMenuItemUitloggen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUitloggenActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItemUitloggen);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);
        jMenuBar1.add(Box.createGlue());

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnNieuwActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNieuwActionPerformed
        new DialogNewWebinar(this, true, gid).setVisible(true);
    }//GEN-LAST:event_btnNieuwActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        DialogNewWebinar dialog = new DialogNewWebinar(this, true, gid);
        dialog.setVisible(true);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        new DialogWijzigen(this, true, gid).setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jListIngeschrevenMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListIngeschrevenMouseClicked
        if (!wc.geefIngeschrevenWebinars(gid).isEmpty()) {
            new DialogIngeschrevenWebinar(this, true, ((Webinar) jListIngeschreven.getSelectedValue()), gid).setVisible(true);
        }
    }//GEN-LAST:event_jListIngeschrevenMouseClicked

    private void jMenuItemUitloggenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUitloggenActionPerformed
        dispose();
        new LoginFrame().setVisible(true);
    }//GEN-LAST:event_jMenuItemUitloggenActionPerformed

    private void jListBeschikbareMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListBeschikbareMouseClicked
        if (!wc.geefBeschikbareWebinars(gid).isEmpty()) {
            new DialogInschrijvenWebinar(this, true, ((Webinar) jListBeschikbare.getSelectedValue()), gid).setVisible(true);
        }
    }//GEN-LAST:event_jListBeschikbareMouseClicked

    private void jMenuItemVerwijderenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemVerwijderenActionPerformed
        int response = JOptionPane.showConfirmDialog(null, "Bent u zeker?\nAl de geplande webinars worden ook verwijderd.", "Account verwijderen",
                JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (response == JOptionPane.NO_OPTION) {
        } else if (response == JOptionPane.YES_OPTION) {
            wc.verwijderGebruiker(gid);
            dispose();
            new LoginFrame().setVisible(true);

        } else if (response == JOptionPane.CLOSED_OPTION) {
        }
    }//GEN-LAST:event_jMenuItemVerwijderenActionPerformed

    private void jListGeplandeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListGeplandeMouseClicked
        if (!wc.geefGeplandeWebinars(gid).isEmpty()) {
            new DialogGeplandeWebinar(this, true, ((Webinar) jListGeplande.getSelectedValue()), gid).setVisible(true);
        }
    }//GEN-LAST:event_jListGeplandeMouseClicked

private void jListGepasseerdeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListGepasseerdeMouseClicked
    if (!wc.geefGepasseerdeWebinars(gid).isEmpty()) {
        new DialogGepasseerdeWebinar(this, true, ((Webinar) jListGepasseerde.getSelectedValue()), gid).setVisible(true);
    }
}//GEN-LAST:event_jListGepasseerdeMouseClicked

private void listActiefMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listActiefMouseClicked

    if (!wc.geefActieveWebinars(gid).isEmpty()) {
        if (((Webinar) listActief.getSelectedValue()).getInstructeur() == gid) {
            new InstructorWindow(this, ((Webinar) listActief.getSelectedValue()).getInstructeur(),
                    ((Webinar) listActief.getSelectedValue())).setVisible(true);
        } else {
            new GebruikerSessie(this, ((Webinar) listActief.getSelectedValue()), gid).setVisible(true);
        }
    }
}//GEN-LAST:event_listActiefMouseClicked
    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnNieuw;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JList jListBeschikbare;
    private javax.swing.JList jListGebruikers;
    private javax.swing.JList jListGepasseerde;
    private javax.swing.JList jListGeplande;
    private javax.swing.JList jListIngeschreven;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItemUitloggen;
    private javax.swing.JMenuItem jMenuItemVerwijderen;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JList listActief;
    private javax.swing.JScrollPane scrollActief;
    // End of variables declaration//GEN-END:variables

    @Override
    public void update(Observable arg0, Object arg1) {
        timer.restart();
        if (arg1.equals("wijzigGebruiker")) {
            wc.updateGebruikers();
            g = wc.getR().getGebruikers().get(gid);
            setTitle(g.getFamilienaam() + " " + g.getVoornaam());
        }
        if (arg1.equals("nieuweWebinar")) {
            jListGeplande.setModel(wc.geefGeplandeWebinars(gid));

        }
        if (arg1.equals("nieuweInschrijving")) {
            jListIngeschreven.setModel(wc.geefIngeschrevenWebinars(gid));
            jListBeschikbare.setModel(wc.geefBeschikbareWebinars(gid));
        }
        if (arg1.equals("wijzigWebinar")) {
            jListGeplande.setModel(wc.geefGeplandeWebinars(gid));
        }
        if (arg1.equals("start")) {
            jListGeplande.setModel(wc.geefGeplandeWebinars(gid));
        }
        if (arg1.equals("stop")) {
            jListGepasseerde.setModel(wc.geefGepasseerdeWebinars(gid));
            jListBeschikbare.setModel(wc.geefBeschikbareWebinars(gid));
            jListGeplande.setModel(wc.geefGeplandeWebinars(gid));
        }
        if (arg1.equals("verwijderWebinar")) {
            jListGeplande.setModel(wc.geefGeplandeWebinars(gid));
        }
    }
    
}